﻿<UserControl x:Class="EasyInvoice.WPF.Content.LogIn"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:mui="http://firstfloorsoftware.com/ModernUI"
      xmlns:common="clr-namespace:EasyInvoice.WPF.Common"
      xmlns:vm="clr-namespace:EasyInvoice.WPF.ViewModel"       >
    <UserControl.DataContext>
        <vm:LogInViewModel/>
    </UserControl.DataContext>
    <Grid Style="{StaticResource ContentRoot}">
        <ScrollViewer>
            <StackPanel  Orientation="Vertical" HorizontalAlignment="Center">
                <StackPanel.Resources>
                    <Style TargetType="StackPanel">
                        <Setter Property="Orientation" Value="Horizontal" />
                        <Setter Property="Margin" Value="0,0,0,4" />
                    </Style>
                    <Style TargetType="TextBlock">
                        <Setter Property="Width" Value="120" />
                        <Setter Property="VerticalAlignment" Value="Center" />
                    </Style>
                </StackPanel.Resources>

                <TextBlock Text="User Authentication" Style="{StaticResource Heading1}" Margin="0,0,0,8"/>
                <mui:BBCodeBlock BBCode="Please type in your user name and password for this session." Margin="0,0,0,32"/>
                <StackPanel>
                    <TextBlock Text="User Name:"  />
                    <TextBox Text="{Binding UserName,Mode=TwoWay, ValidatesOnDataErrors=True}" MinWidth="300" MaxWidth="450" />
                   
                </StackPanel>
                <StackPanel>
                    <TextBlock Text="Password:"  />
                    <PasswordBox MinWidth="300" MaxLength="40" 
                                 common:PasswordHelper.Attach="True"
                                 common:PasswordHelper.Password="{Binding Text,ElementName=plain,Mode=TwoWay}"
                                 />
                    
                </StackPanel> 
                <StackPanel>
                    
                    <TextBlock  x:Name="plain" Text="{Binding Password, Mode=TwoWay}" Visibility="Hidden"/>
                    <Button Command="{Binding ShowLoginCommand}" Content="log in" Margin="0,32,0,8" Width="140" IsDefault="True"/>
                    
                    <Button Command="{Binding ShowCancelCommand}" Content="cancel" Margin="20,32,0,8" Width="140" IsCancel="True"/>
                </StackPanel>

            </StackPanel>
            
        </ScrollViewer>
    </Grid>
</UserControl>
